<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @copyright   Copyright (c) 2014 X.commerce, Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<div class="grid">
    <table cellspacing="0" class="data-table">
        <thead>
        <tr>
            <th class="col-product no-link"><?php echo __('Product Name') ?></th>
            <th class="col-weight no-link"><?php echo __('Weight') ?></th>
            <th class="col-custom no-link" <?php echo $this->displayCustomsValue() ? '' : 'style="display: none;"' ?>>
                <?php echo __('Customs Value') ?>
            </th>
            <th class="col-select no-link">
                <input type="checkbox" name="" onclick="packaging.checkAllItems(this);" class="checkbox" title="<?php echo __('Select All') ?>">
            </th>
            <th class="col-qty no-link"><?php echo __('Qty Ordered') ?></th>
            <th class="col-qty-edit no-link last"><?php echo __('Qty') ?></th>
        </tr>
        </thead>

        <tbody>
        <?php foreach($this->getCollection() as $item): ?>
            <?php $_order = $this->getShipment()->getOrder() ?>
            <?php $_orderItem = $_order->getItemById($item->getOrderItemId()); ?>
            <?php if ($item->getIsVirtual()
                || ($_orderItem->isShipSeparately() && !($_orderItem->getParentItemId() || $_orderItem->getParentItem()))
                || (!$_orderItem->isShipSeparately() && ($_orderItem->getParentItemId() || $_orderItem->getParentItem()))): ?>
                <?php continue; ?>
                <?php endif; ?>
        <tr title="#" id="" class="">
            <td class="col-product name">
                <?php echo $item->getName(); ?>
            </td>
            <td class="col-weight weight ">
                <?php echo $item->getWeight(); ?>
            </td>
            <?php
            if ($this->displayCustomsValue()) {
                $customsValueDisplay = '';
                $customsValueValidation = ' validate-zero-or-greater ';
            } else {
                $customsValueDisplay = ' style="display: none;" ';
                $customsValueValidation = '';
            }
            ?>
            <td <?php echo $customsValueDisplay ?>>
                <input type="text" name="customs_value" class="input-text <?php echo $customsValueValidation ?>" value="<?php echo $this->formatPrice($item->getPrice()); ?>" size="10" onblur="packaging.recalcContainerWeightAndCustomsValue(this);">
            </td>
            <td class="col-select">
                <input type="checkbox" name="" value="<?php echo $item->getId() ? $item->getId() : $item->getOrderItemId(); ?>" class="checkbox">
            </td>
            <td class="col-qty">
                <?php echo $item->getOrderItem()->getQtyOrdered()*1; ?>
            </td>
            <td class="col-qty-edit last">
                <input type="hidden" name="price" value="<?php echo $item->getPrice(); ?>">
                <input type="text" name="qty" value="<?php echo $item->getQty()*1; ?>" class="input-text qty<?php if ($item->getOrderItem()->getIsQtyDecimal()): ?> qty-decimal<?php endif ?>">&nbsp;
                <button type="button" class="action- delete icon-btn" onclick="packaging.deleteItem(this);" style="display:none;">
                    <span><?php echo __('Delete') ?></span>
                </button>
            </td>
        </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
</div>
